package com.santiao.fuel.ui.activity

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gyf.immersionbar.ImmersionBar
import com.santiao.fuel.R
import com.santiao.fuel.bean.GasEquipBean
import com.santiao.fuel.ui.adapter.GasEquipAdapter
import com.santiao.fuel.utils.DisplayUtil
import com.santiao.publics.ui.SettingFragment
import java.util.Collections

class GasEquipActivity : AppCompatActivity() {

    companion object{
        fun comeGasEquipActivity(activity: Activity){
            activity.startActivity(Intent(activity ,GasEquipActivity::class.java))

        }


    }


    var gas_equips =  ArrayList<GasEquipBean>()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_gas_equip)

        initData();
        initActionBar();
        initView();
        SettingFragment.adLoad(1, null, findViewById(R.id.fl_content_1), this, this)
    }

    private fun initActionBar() {
        DisplayUtil.initActionBar(this)
    }

    private fun initData() {

        Collections.addAll(gas_equips , GasEquipBean(R.mipmap.tools_1 , "燃气灶具" , "包括燃气炉灶、燃气烤箱和燃气烧烤架等，用于\n" +
                "烹饪和烘焙"))

        Collections.addAll(gas_equips , GasEquipBean(R.mipmap.tools_2 , "燃气热水器" , "提供热水，用于洗浴、洗涤等"))
        Collections.addAll(gas_equips , GasEquipBean(R.mipmap.tools_3 , "燃气锅炉" , "用于供暖和提供生活热水" ))
        Collections.addAll(gas_equips , GasEquipBean(R.mipmap.tools_4 , "燃气壁炉" , "提供室内取暖和装饰效果"))
        Collections.addAll(gas_equips , GasEquipBean(R.mipmap.tools_5 , "燃气取暖器" , "便携式或固定式的取暖设备，用于室内或室外取暖"))
    }


    // 设置视图
    private fun initView() {

        val gasBarRootView = findViewById<RelativeLayout>(R.id.gas_bar)
        val page_title = gasBarRootView.findViewById<TextView>(R.id.page_title)
        val page_back = gasBarRootView.findViewById<ImageView>(R.id.page_back)

        page_title.text = "燃气设备大全"
        page_back.setOnClickListener {
            finish()
        }

        val gas_equip_list = findViewById<RecyclerView>(R.id.gas_equip_list)

        gas_equip_list.layoutManager = LinearLayoutManager(this)
        gas_equip_list.adapter = GasEquipAdapter(this ,R.layout.gas_equip_item , gas_equips);


    }




    fun initStatus() {

    }
}